<!--
*@Author: QWP
*@Description: 级联选择器
*@Date: 2023-03-28 15:11:52
-->
<template>
  <a-cascader
    v-bind="$attrs"
    v-model:value="value"
    :showCheckedStrategy="$attrs.showCheckedStrategy || 'Cascader.SHOW_CHILD'"
    :allowClear="$attrs.allowClear || allowClear"
    style="width: 100%"
    ref="cascader"
    @change="change"
  >
  </a-cascader>
</template>

<script lang="ts" setup>
defineOptions({ name: 'u-cascader' })
import { ref, reactive, watch, useAttrs } from "vue";

const attrs = useAttrs()
const props = withDefaults(
  defineProps<{
    value: any,
    resultType: 'string' | 'array',
  }>(),
  {
    resultType: 'string'
  }
)
const emits = defineEmits(['update:value', 'change'])
const value = ref<string[] | number[]>()

const change = (value, selectedOptions) => {
  emits('update:value', value)
  emits('change', value, selectedOptions)
}

</script>
<style lang="scss">
</style>